using System;
using UnityEngine;

namespace EventBehaviorTree
{
    [Serializable]
    public class EventNode
    {
        public string _key;
        [NonSerialized] protected MonoBehaviour _monoBehavior;
        protected Action<NodeMessage> CompositeNodeEvent = delegate { };
        public virtual void Initialize(MonoBehaviour behaviorTree) { _monoBehavior = behaviorTree; }
        /// <summary>
        /// set the event to send message
        /// </summary>
        /// <param name="nodeEvent">parent node event</param>
        public void AddEvent(Action<NodeMessage> nodeEvent) { CompositeNodeEvent += nodeEvent; }
        public virtual void NodeEvent(NodeMessage nodeMessage) { }
        public virtual void Reset() { }
    }
}
